# -*- coding:utf-8 -*-

import os
import psutil
from os.path import join, getsize
 
 
# 版本：提取指定盘和大小的文件及文件夹
 
 
def get_paths_size(dirs, maxnum):
    # 提取指定文件夹和大小的函数
    print(f"{dirs} -> 文件夹内文件占用空间：")
    size = 0
    for root, dirs, files in os.walk(dirs):
        sums = sum([getsize(join(root, file)) for file in files]) // 1024 // 1024
        if sums > maxnum:
            print(f'{sums:>8,d} MB -> {root}')
        size += sums
 
    print(f'{size:>8,d} MB -> 总大小')
 
 
def get_files_size(dirs, maxnum):
    # 提取指定文件夹内文件和大小的函数
    print(f"{dirs} -> 文件占用空间：")
    size = 0
    for root, dirs, files in os.walk(dirs):
        for file in files:
            fpth = join(root, file)
            sums = getsize(fpth) // 1024 // 1024
            if sums > maxnum:
                print(f'{sums:>8,d} MB -> {fpth}')
            size += sums
 
    print(f'{size:>8,d} MB -> 总大小')
	
	
	
def get_windows_partition():
    print(psutil.disk_partitions())


